Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] Replace GLOB_BRACE with a more robust solution #2064

Merged
merged 60 commits into from
Dec 19, 2024

Conversation

caendesilva
Copy link
Member

@caendesilva caendesilva commented Dec 11, 2024

Replaces glob brace usages as some Linux distros do not support it, for instance Alpine, which hurts Docker support.

Related issues: (Which this will probably fix)

Will fix #2063

Copy link

codecov bot commented Dec 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (16c04b0) to head (b41253e).
Report is 63 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##              master     #2064   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity      1774      1774           
===========================================
  Files            183       183           
  Lines           4782      4782           
===========================================
  Hits            4782      4782           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@caendesilva caendesilva force-pushed the replace-glob-brace branch 2 times, most recently from 8ad38c7 to 34bd942 Compare December 13, 2024 19:01
@caendesilva
Copy link
Member Author

I think it makes sense for a file finder to handle file extensions in a case-insensitive manner, especially in scenarios where the target operating system or use case does not enforce case sensitivity. This is particularly important because:

  1. Cross-Platform Consistency: Different operating systems handle case sensitivity differently. For example:

    • Windows and macOS treat file extensions as case-insensitive.
    • Linux is case-sensitive. Making the file finder case-insensitive ensures predictable behavior across all platforms.
  2. User Convenience: Users might unintentionally create files with mixed-case extensions (e.g., .MD vs .md). A case-insensitive approach avoids confusion and ensures files are found regardless of how the extension is written.

  3. Practicality: When searching by extension, the intent is generally to match all files of a certain type, not to differentiate based on casing.

@caendesilva
Copy link
Member Author

I think we should sort the output in the method too to further normalize different file systems. It takes just 0.010ms to sort 100 files, so that's fully acceptable.

@caendesilva
Copy link
Member Author

Better to have paths relative to the project root to follow the conventions, and how we will use it. Especially since it's a drop in replacement for the smart glob method which is relative to the project.

@caendesilva caendesilva force-pushed the replace-glob-brace branch 7 times, most recently from 3194b94 to 85750da Compare December 15, 2024 14:29
caendesilva added a commit to hydephp/framework that referenced this pull request Dec 15, 2024
@caendesilva
Copy link
Member Author

Okay, I think this is ready for merge, and assuming the root cause of the two suspected related issues is GLOB_BRACE, this should fix those.

To test this, run the following command in your project terminal:

composer require hyde/framework:dev-replace-glob-brace-preview

Then rerun the reproduction steps that led to your issues.

If either of you don't have time to test it, that's totally okay, just let me know. I will be going out of town for a few days and will hold of on merging this until then as I can't properly support a release rollout until the end of the week.

@caendesilva caendesilva marked this pull request as ready for review December 15, 2024 15:20
@sobi3ch
Copy link

sobi3ch commented Dec 18, 2024

@caendesilva works like a charm
image

@caendesilva
Copy link
Member Author

@caendesilva works like a charm

@sobi3ch Thank you so much for taking the time to test it! I'll be going ahead and merge this, and I will try for a weekend release, if not earlier!

@caendesilva caendesilva disabled auto-merge December 19, 2024 20:12
@caendesilva caendesilva changed the title [1.x] Replace GLOB_BRACE with more robust solutions [1.x] Replace GLOB_BRACE with a more robust solution Dec 19, 2024
@caendesilva caendesilva merged commit 0d1280c into master Dec 19, 2024
21 checks passed
@caendesilva caendesilva deleted the replace-glob-brace branch December 19, 2024 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants